package demo01;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-04-02
 * Time: 15:36
 */
//多线程的简单实现
class MyThread extends Thread {
    //多线程
    @Override
    public void run() {
        while(true)
        {
            System.out.println("Hello thread !");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            } finally {
            }
        }
    }
}
public class test01 {
    public static void main(String[] args) {
        MyThread t = new MyThread();
        t.start();

        //mian 的线程
        while(true) {
            System.out.println("main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            } finally {
            }
        }
    }
}
